import QtQuick 2.3
import QtQuick.Controls 1.2
import "qrc:///content"
import "qrc:///Constants.js" as Constants

ApplicationWindow
{
    id: appWindow
    visible: true
    width: 900
    height: 600
    title: "Whandgo"
    // flags: Qt.FramelessWindowHint

    /* Loading
    {
        id: loadingWindow
        anchors.fill: parent
    } */

    MainWindow
    {
        id: mainWindow
        anchors.fill: parent
    }

    /* join new user window */
    RegisterUser
    {
        id: joinWindow
        anchors.fill: parent
        onLoginClicked:
        {
            joinWindow.showView(false)
            registerWindow.showView(true)
        }
    }

    /* signIn existing user */
    Registered
    {
        id:  signInWindow
        anchors.fill: parent
        onLoginClicked:
        {
            signInWindow.showView(false)
            mainWindow.showView(true)
        }
    }

    /* register window */
    Register
    {
        id: registerWindow
        anchors.fill: parent
        onSignInFacebookClicked:
        {
            registerWindow.showView(false)
        }

        onJoinClicked:
        {
            registerWindow.showView(false)
            joinWindow.showView(true)
        }

        onSignInClicked:
        {
            registerWindow.showView(false)
            signInWindow.showView(true)
        }
    }

    Component.onCompleted:
    {
        joinWindow.showView(false)
        signInWindow.showView(false)
        registerWindow.showView(false)
        mainWindow.showView(true)
    }
}
